# -*- coding: utf-8 -*-
# File : my_regex.py
# Author: taoyahui
# Date : 2022/6/1

# 这是一个正则表达式的练习

# 一般字符练习1
import re
# 创建匹配规则
pattern = re.compile('abcd')
# 匹配字符串
result = pattern.findall('abcdefghijklmnopqrst')
# 打印结果
print(result)
print(f"{'*' * 100}")

# 一般字符练习2

pattern = re.compile('abcd', re.I) # 不区分大小写
result = pattern.findall('abcdABCD')
print(result)
print(f"{'*' * 100}")

# 练习 .1

regex = 'a.c'
pattern = re.compile(regex)
result = pattern.findall('acc')
print(result)
print(f"{'*' * 100}")


# 练习 .2
regex = 'a.c'
pattern = re.compile(regex, re.DOTALL)
result = pattern.findall("""a
c""")

print(result)
